<%@ page import="com.sun.xml.internal.ws.util.xml.CDATA" %>
<%@ page import="java.util.Date" %>
<%@ page import="edu.gd.dao.UserDao" %>
<%@ page import="java.util.List" %>
<%@ page import="edu.gd.entity.User" %>
<%--
  Created by IntelliJ IDEA.
  User: DELL
  Date: 2020/10/23
  Time: 17:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>测试</title>
</head>
<body>
<jsp:include page="header.jsp" flush="true"/>
<%
    String id=request.getParameter("id");
    User u1=UserDao.getUserByID(id);
%>
<form action="" method="get" style="text-align: center">
    user:<input type="text" id="user" name="username" value="3">
    password:<input type="password" name="password" value="<%=u1==null?"":u1.getPassword()%>">
    <input type="submit" value="登录" onclick="checkform()">
    <a href="regist.jsp">注册</a>
</form>
<jsp:include page="footer.jsp" flush="true"/>
    <%
        int i=(int)(Math.random()*101);
        if(i%2==0)
            out.println("<h1> i="+i+"是偶数</h1>");
        else
            out.println("<h1> i="+i+"是奇数</h1>");
        List<User> users=UserDao.getUsers();
        for(User user:users){
            out.println("<p>"+user.toString()+"</p>");
        }
    %>
</body>
<script>
    function checkform() {
        var $user_name = document.getElementById("user").value;
        var $user_pwd = document.getElementsByName("password").value;
            alert($user_name);
    }
</script>
</html>
